# nums = [2,2,3,2]
nums = [0,1,0,1,0,1,99]
def singleNumber(nums):
    #如果仅有一个元素
    if len(nums)==1:
        return nums[0]
    nums.sort()
    print(nums)
    pre=nums[0]
    cur_elem=1
    for i in range(1,len(nums)):
        print("pre:",pre," nums[i]:",nums[i])
        if pre==nums[i]:
            #当前元素值的数量+1
            cur_elem+=1
        else:
            #不相等的情况
            if cur_elem>=3:
                print("进入3")
                #数量是3
                pre=nums[i]
                cur_elem=1
            else:
                #数量是1
                return pre
    return pre


print(singleNumber(nums))
